package com.ieasy.module.site.entity;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.ieasy.basic.dao.ExtFieldEntity;

@Entity @Table(name="ieasy_site_magic_pic")
public class MagicPicEntity extends ExtFieldEntity {

	private String name ;
	
	private String path ;
	
	private String remark ;
	
	private String identity ;
	
	/** true：图片下架 */
	private boolean status ;
	
	/** 是否类别 */
	private Boolean isCategory = Boolean.TRUE ;
	
	private Integer sort = new Integer(1) ;
	
	private MagicPicEntity magic ;
	
	private Set<MagicPicEntity> magics ;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIdentity() {
		return identity;
	}

	public void setIdentity(String identity) {
		this.identity = identity;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public boolean isStatus() {
		return status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	public Boolean getIsCategory() {
		return isCategory;
	}

	public void setIsCategory(Boolean isCategory) {
		this.isCategory = isCategory;
	}

	@ManyToOne
	@JoinColumn(name = "pid")
	public MagicPicEntity getMagic() {
		return magic;
	}

	public void setMagic(MagicPicEntity magic) {
		this.magic = magic;
	}

	@OneToMany(mappedBy = "magic", fetch = FetchType.LAZY)
	@OrderBy("sort asc")
	public Set<MagicPicEntity> getMagics() {
		return magics;
	}

	public void setMagics(Set<MagicPicEntity> magics) {
		this.magics = magics;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}
	
}
